package com.webflux.controller;

import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

@RestController
public class DemoController {
  @Resource
  private WebClient.Builder webClientBuilder;

  @GetMapping("test")
  public Mono<String> demo(String name) {
    return webClientBuilder.build()
        .get()
        .uri("http://nacos-discovery-provider/demo?name="+name)
        .retrieve()
        .bodyToMono(String.class);
  }

}
